package com.miao.util.base.pojo;

import org.apache.commons.lang.StringUtils;

import java.util.HashMap;
import java.util.LinkedHashSet;


public class RelMap extends HashMap<String, LinkedHashSet<Basic>> {

    @Override
    public LinkedHashSet<Basic> put(String key, LinkedHashSet<Basic> value) {
        LinkedHashSet<Basic> _val = super.get(key);
        if (_val == null) {
            _val = new LinkedHashSet<Basic>();
        }
        if (StringUtils.isNotBlank(key) && value != null) {
            _val.addAll(value);
            return super.put(key, _val);
        }
        return _val;
    }

    public LinkedHashSet<Basic> putOne(String key, Basic value) {
        LinkedHashSet<Basic> _val = super.get(key);
        if (_val == null) {
            _val = new LinkedHashSet<Basic>();
        }
        if (StringUtils.isNotBlank(key) && value != null) {
            _val.add(value);
            return super.put(key, _val);
        }
        return _val;
    }
}
